<?php

namespace app\admin\service;

use app\lib\exception\Common as CommonException;
use app\admin\model\AdminLog as Model;

class AdminLog
{
    static function getList($param): array
    {
        $list = [];
        $where = [];
        if (!empty($param['username'])) {
            $where[] = ['username', 'like', '%' . $param['username'] . '%'];
        }

        $total = (new Model)->where($where)->count();
        if ($total > 0) {
            $list = (new Model)->where($where)->page($param['pageNum'], $param['pageSize'])->select();
        }

        return ['list' => $list, 'total' => $total];
    }
}